<template>
    <div>
        <el-dialog title="删除" :visible.sync="dish_delete" width="30%" :before-close="handleClose">
            <span>您确定要删除该菜品吗？</span>
            <span slot="footer" class="dialog-footer">
                <el-button @click="handleClose">取 消</el-button>
                <el-button type="primary" @click="submit">确 定</el-button>
            </span>
        </el-dialog>

    </div>

</template>
<script>
export default {
  name: 'dishDeleteView',
  props: {
    dish_delete: {
      type: Boolean,
      default: false
    },
    dishInfo_delete: Object
  },
  data () {
    return {
      ruleForm: {
        id: ''
      }
    }
  },
  watch: {
    dishInfo_delete: {
      handler (newVal, oldVal) {
        this.ruleForm = Object.assign({
          id: newVal.id
        })
        console.log(newVal.id, oldVal)
      }
    }
  },
  methods: {
    handleClose () {
      this.$emit('update:dish_delete', false)
    },
    submit () {
      console.log(this.ruleForm.id)
      this.$emit('update:dish_delete', false)
      this.$emit('update:dishInfo_delete', this.ruleForm)
      this.$parent.Deletequery(this.ruleForm.id)
      this.nextTick(this.$parent.query)
    }
  }
}
</script>
